package main

import "fmt"

func main() {

	aaa := make([]interface{},4)

	aaa[0] = "111"
	aaa[1] =  111
	aaa[2] =  1.22
	aaa[3] =  '王'

	for _, v := range aaa {

		//类型断言
		//第一个返回值data是他的值,第二个是判断是否为string
		switch v.(type) {

		case string:
			fmt.Printf("v is %s , v type is %T \n",v,v)
		case int:
			fmt.Printf("v is %d , v type is %T \n",v,v)
		case float64:
			fmt.Printf("v is %e , v type is %T \n",v,v)
		case rune:
			fmt.Printf("v is %c , v type is %T \n",v,v)
		}

	}
}
